<!DOCTYPE html>

<body>
  <iframe src="resources/body-overflow-iframe.html" height="100px"></iframe>
  <div id='console'></div>
</body>

<script src="../../resources/js-test.js"></script>
<script>
description("Test that when the hit test of input event in an iframe does not hit " +
            "anything (not even the html/body), the input event is still captured " +
            "the iframe's document")

document.addEventListener("contextmenu", function(){
  debug("FAIL context_menu_triggered in main frame");
});

document.addEventListener("click", function(){
  debug("FAIL click_triggered in main frame");
});

if (!window.eventSender) {
  testFailed('window.eventSender is required for this test.');
}

if (window.testRunner) {
  testRunner.dumpAsText();
  testRunner.waitUntilDone();
}

window.addEventListener("message", function(evt) {
   if (evt.data == "subframe-loaded") {
     // Tap and left/right click in the iframe that does not hit the body
     // and the child div but should still be dispatched to the iframe's
     // document element.
     debug('Sending a gesture tap');
     eventSender.gestureTap(100, 50);
     debug('Sending left click');
     eventSender.mouseMoveTo(100, 50);
     eventSender.mouseDown();
     eventSender.mouseUp();
     debug('Sending right click');
     eventSender.mouseDown(2);
     eventSender.mouseUp(2);
     if (window.testRunner)
       testRunner.notifyDone();
   }

}, true);

</script>
